package com.pro.controller;


import com.pro.pojo.JsUserOrder;
import com.pro.pojo.JsonData;
import com.pro.service.JsUserOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author 李佳豪
 * @date 2022/1/6 19:31
 */
@RestController
@RequestMapping("/Order")
public class JsUserOrderController {
    @Autowired
    JsUserOrderService jsUserOrderService;
    /**
     * @author 李佳豪
     * 根据课程订单状态获取课程数量
     */
    @RequestMapping(value = "/TotalCourseStatusCalculations")
    public JsonData TotalCourseStatusCalculations(Integer orderType,Integer orderStatus){
        Integer integer = jsUserOrderService.TotalCourseStatusCalculations(orderType, orderStatus);
        return integer != null ?JsonData.buildSuccess(integer):JsonData.buildError("服务器出错了");
    }

    /**
     * @author 李佳豪
     * 订单处理列表、退货中、已退货
     */
    @RequestMapping(value = "/UnsubscribeProcessingCount")
    public JsonData UnsubscribeProcessingCount(){
        Map<String, Object> map = jsUserOrderService.UnsubscribeProcessingCount();
        return map != null ?JsonData.buildSuccess(map):JsonData.buildError("服务器出错了");
    }
    /**
     * @author 李佳豪
     * @date 2022/1/10 3:11
     * 查询所有课程订单
     */
    @RequestMapping(value = "/getAllCourseOrder")
    public JsonData getAllCourseOrder(JsUserOrder param){
        List<JsUserOrder> allCourseOrder = jsUserOrderService.getAllCourseOrder(param);
        return allCourseOrder != null ?JsonData.buildSuccess(allCourseOrder):JsonData.buildError("服务器出错了");
    }
    /**
     * @author 李佳豪
     * @date 2022/1/10 4:49
     * 根据状态查询课程订单
     */
    @RequestMapping(value = "/QueryCourseOrdersByStatus")
    public JsonData QueryCourseOrdersByStatus(JsUserOrder param){
        List<JsUserOrder> allCourseOrder = jsUserOrderService.QueryCourseOrdersByStatus(param);
        return allCourseOrder != null ?JsonData.buildSuccess(allCourseOrder):JsonData.buildError("服务器出错了");
    }
    /**
     * @author 李佳豪
     * @date 2022/1/11 10:08
     * 根据id删除订单
     */
    @RequestMapping(value = "/DeleteOrderById")
    public JsonData DeleteOrderById(Integer orderId){
        int i = jsUserOrderService.DeleteOrderById(orderId);
        return i != 0 ?JsonData.buildSuccess(i):JsonData.buildError("服务器出错了");
    }
    /**
     * @author 李佳豪
     * @date 2022/1/11 11:10
     * 根据id删除订单
     */
    @RequestMapping(value = "/OrderAdvancedRetrieval")
    public JsonData OrderAdvancedRetrieval(JsUserOrder param){
        List<JsUserOrder> jsUserOrders = jsUserOrderService.OrderAdvancedRetrieval(param);
        return jsUserOrders != null ?JsonData.buildSuccess(jsUserOrders):JsonData.buildError("服务器出错了");
    }
    /**
     * @author 李佳豪
     * @date 2022/1/12 10:20
     * 已取消订单查询
     */
    @RequestMapping(value = "/CancelledOrder")
    public JsonData CancelledOrder(JsUserOrder param){
        Map<String, Object> map = jsUserOrderService.CancelledOrder(param);
        return map != null ?JsonData.buildSuccess(map):JsonData.buildError("服务器出错了");
    }
    /**
     * @author 李佳豪
     * @date 2022/1/12 10:20
     * 已受理订单查询
     */
    @RequestMapping(value = "/GetAllAcceptedOrders")
    public JsonData GetAllAcceptedOrders(JsUserOrder param){
        List<JsUserOrder> jsUserOrders = jsUserOrderService.GetAllAcceptedOrders(param);
        return jsUserOrders != null ?JsonData.buildSuccess(jsUserOrders):JsonData.buildError("服务器出错了");
    }
    /**
     * @author 李佳豪
     * @date 2022/1/12 10:20
     * 已受理订单高级检索
     */
    @RequestMapping(value = "/AcceptedOrdersAdvancedRetrieval")
    public JsonData AcceptedOrdersAdvancedRetrieval(JsUserOrder param){
        List<JsUserOrder> jsUserOrders = jsUserOrderService.AcceptedOrdersAdvancedRetrieval(param);
        return jsUserOrders != null ?JsonData.buildSuccess(jsUserOrders):JsonData.buildError("服务器出错了");
    }
    /**
     * @author 李佳豪
     * @date 2022/1/12 10:20
     * 已受理订单统计
     */
    @RequestMapping(value = "/AcceptedOrdersCount")
    public JsonData AcceptedOrdersCount(JsUserOrder param) {
        Map<String, Object> map = jsUserOrderService.AcceptedOrdersCount(param);
        return map != null ?JsonData.buildSuccess(map):JsonData.buildError("服务器出错了");
    }
    /**
     * @author 李佳豪
     * @date 2022/1/12 18:49
     * 根据状态查询已受理订单信息
     */
    @RequestMapping(value = "/QueryAcceptedOrdersByType")
    public JsonData QueryAcceptedOrdersByType(JsUserOrder param) {
        List<JsUserOrder> jsUserOrders = jsUserOrderService.QueryAcceptedOrdersByType(param);
        return jsUserOrders != null ?JsonData.buildSuccess(jsUserOrders):JsonData.buildError("服务器出错了");
    }
    /**
     * @Author 祖铭泽
     * @Date 2022/1/21/0013
     * @description 根据订单状态、订单类型查询订单数量
     */
    @RequestMapping(value = "/getReturnApplicationOrderCount")
    public JsonData getReturnApplicationOrderCount(JsUserOrder jsUserOrder) {
        return jsUserOrderService.getReturnApplicationOrderCount(jsUserOrder);
    }

}
